import { _decorator, Component, Node } from 'cc';
import { http } from '../../common/HTTP';
import { boot } from 'db://assets/boot/boot';
import { lobby } from '../../lobby';
import { userinfo } from '../../UserInfo';
import protocol from 'db://assets/proto/protoExt';
const { ccclass, property } = _decorator;

@ccclass('mainui')
export class mainui extends Component {
    @property(Node)
    btnmenting: Node = null!;
    start() {
        this.btnmenting.on(Node.EventType.TOUCH_END, async () => {
            let res: protocol.new_world.v1.FishCreateResult = await http.requestAsync("POST", "v1/fish/create", { talent_level: 2 }).catch((res: any) => {
                lobby.instance.showToast("招收弟子失败")
            })
            if (!res) return
            userinfo.addFish(res!)
        })
    }

    update(deltaTime: number) {

    }
}


